xen.git
16 years agotools: Fix iptables failure test in vif-common.sh
Keir Fraser [Fri, 7 Aug 2009 16:31:27 +0000 (17:31 +0100)]
tools: Fix iptables failure test in vif-common.sh

In changset 19540 a bug was introduced in the fib_iptable function in
vif-common.sh that incorrectly checks the exit status of iptables --
it always believes iptables has failed even when it hasn't.

The attached patch fixes that.  It's also bug 1490.

Signed-off-by: John Haxby <john.haxby@oracle.com>
16 years agox86: replace PAT initialisation magic value with a #define
Keir Fraser [Fri, 7 Aug 2009 16:30:33 +0000 (17:30 +0100)]
x86: replace PAT initialisation magic value with a #define

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
16 years agox86: Increase default max CPUs to 64.
Keir Fraser [Fri, 7 Aug 2009 16:29:50 +0000 (17:29 +0100)]
x86: Increase default max CPUs to 64.

Also remove compile-time limit of 32 for i386. It is no longer
required, since a cpumask was moved out of struct page_info.

Signed-off-by: Wei Gang <gang.wei@intel.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agox86 p2m: use common p2m ops in common p2m code path
Keir Fraser [Fri, 7 Aug 2009 16:23:11 +0000 (17:23 +0100)]
x86 p2m: use common p2m ops in common p2m code path

We found recently there was an assertion failure when EPT mode is
enabled on 32PAE host when debug=y is used. The patch attached fixes
that. It uses the common p2m ops in the
common p2m code path p2m_remove_page rather than calling
p2m_gfn_to_mfn() for only shadow mode.

Signed-off-by: Xin, Xiaohui <xiaohui.xin@intel.com>
16 years agoxend: Rename device backend value when xm save/migrate
Keir Fraser [Fri, 7 Aug 2009 16:22:04 +0000 (17:22 +0100)]
xend: Rename device backend value when xm save/migrate

The Xend has a problem that it often fails to restore/migrate
a PV domain whose device backends are partly a driver domain.

Because a checkpoint of the PV domain has device backend value as
domain id, you can restore/migrate the PV domain only when a driver
domain is the same id as device backend value in the checkpoint.

I attached a patch to fix it by renaming device backend value in a
checkpoint from domain id to domain name when xm save/migrate.

This patch doesn't rename device backend value if the value is 0,
which is Domain-0, so the checkpoint format is compatible if you use
only Domain-0 as device backend.

Signed-off-by: Rikiya Ayukawa <ayukawa.rikiya@jp.fujitsu.com>
16 years agox86_emulate: Fixes for 'mov rm16,sreg'
Keir Fraser [Fri, 7 Aug 2009 09:53:22 +0000 (10:53 +0100)]
x86_emulate: Fixes for 'mov rm16,sreg'

1. Memory reads should be 16 bits only
2. Attempt to load %cs should result in #UD

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agox86_emulate: protmode_load_seg() cannot load system segments in long mode.
Keir Fraser [Fri, 7 Aug 2009 08:54:43 +0000 (09:54 +0100)]
x86_emulate: protmode_load_seg() cannot load system segments in long mode.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agohvmloader: Regression tests need 16MB to run. Check for this.
Keir Fraser [Thu, 6 Aug 2009 10:14:48 +0000 (11:14 +0100)]
hvmloader: Regression tests need 16MB to run. Check for this.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agoept: code clean up and formatting.
Keir Fraser [Thu, 6 Aug 2009 09:02:20 +0000 (10:02 +0100)]
ept: code clean up and formatting.

Fix alignment and comments and add and remove spaces and lines where
appropriate.

Signed-off-by: Patrick Colp <Patrick.Colp@citrix.com>
16 years agox86_emulate: Remove cmpxchg retry loop from protmode_load_seg().
Keir Fraser [Thu, 6 Aug 2009 08:54:22 +0000 (09:54 +0100)]
x86_emulate: Remove cmpxchg retry loop from protmode_load_seg().

It is safer to retry in a loop via the caller.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agotmem: Remove bogus variable decl, fixing build.
Keir Fraser [Thu, 6 Aug 2009 08:53:37 +0000 (09:53 +0100)]
tmem: Remove bogus variable decl, fixing build.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agotmem: save/restore/migrate/livemigrate and shared pool authentication
Keir Fraser [Thu, 6 Aug 2009 08:19:55 +0000 (09:19 +0100)]
tmem: save/restore/migrate/livemigrate and shared pool authentication

Attached patch implements save/restore/migration/livemigration
for transcendent memory ("tmem").  Without this patch, domains
using tmem may in some cases lose data when doing save/restore
or migrate/livemigrate.  Also included in this patch is
support for a new (privileged) hypercall for authorizing
domains to share pools; this provides the foundation to
accomodate upstream linux requests for security for shared
pools.

Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com>
16 years agoept mtrr: replace unsigned long with mfn_t for mfns.
Keir Fraser [Thu, 6 Aug 2009 08:15:42 +0000 (09:15 +0100)]
ept mtrr: replace unsigned long with mfn_t for mfns.

Signed-off-by: Patrick Colp <Patrick.Colp@citrix.com>
16 years agoept p2m: replace unsigned long with mfn_t for mfns.
Keir Fraser [Thu, 6 Aug 2009 08:15:24 +0000 (09:15 +0100)]
ept p2m: replace unsigned long with mfn_t for mfns.

Signed-off-by: Patrick Colp <Patrick.Colp@citrix.com>
16 years agoept p2m: set rwx flags to 0 for invalid and mmio_dm types.
Keir Fraser [Thu, 6 Aug 2009 08:14:52 +0000 (09:14 +0100)]
ept p2m: set rwx flags to 0 for invalid and mmio_dm types.

Read/write/execute flags are set to 1 before calling the type_to_flags
function which sets them to their appropriate values depending on the
p2m type. However, in invalid, mmio_dm, and default/unknown cases in
type_to_flags just falls through, unsafely leaving full access to
these pages.

Signed-off-by: Patrick Colp <Patrick.Colp@citrix.com>
16 years agoRevert 20006:edf21ab7d7a4 and 20023:2b28320c6f8c.
Keir Fraser [Wed, 5 Aug 2009 13:56:29 +0000 (14:56 +0100)]
Revert 20006:edf21ab7d7a4 and 20023:2b28320c6f8c.

16 years agoRevert to pulling QEMU GIT repo via HTTP.
Keir Fraser [Wed, 5 Aug 2009 13:39:46 +0000 (14:39 +0100)]
Revert to pulling QEMU GIT repo via HTTP.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agoxend: Remove _setSchedParams
Keir Fraser [Wed, 5 Aug 2009 13:03:38 +0000 (14:03 +0100)]
xend: Remove _setSchedParams

Currently, xc.sched_credit_domain_set is called twice when domains
are created.

start@XendDomainInfo
  _constructDomain
    xc.sched_credit_domain_set  --- 1st
  _initDomain
    _setSchedParams
      domain_sched_credit_set
        xc.sched_credit_domain_set  --- 2nd

resume@XendDomainInfo
  _constructDomain
    xc.sched_credit_domain_set  --- 1st
  _setSchedParams
    domain_sched_credit_set
      xc.sched_credit_domain_set  --- 2nd

This patch removes _setSchedParams method added by changeset 19955,
because xc.sched_credit_domain_set was added into _constructDomain
method by changeset 20006.

Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
16 years agox86 vmx: Accelerate VLAPIC EOI writes
Keir Fraser [Wed, 5 Aug 2009 13:02:46 +0000 (14:02 +0100)]
x86 vmx: Accelerate VLAPIC EOI writes

Our testing indicates that most apic accesses are eoi writes. This
patch accelerate guest EOI emulation utilizing HW VM Exit
information.

Without this patch, xentrace shows the apci access average tsc costs
is ~7.8k in our case and it down to ~3k with it. We also save 3% cpu
in our case.

From: Yang Zhang <yang.zhang@intel.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agox86: CPU synchronization while doing MTRR register update
Keir Fraser [Wed, 5 Aug 2009 12:50:36 +0000 (13:50 +0100)]
x86: CPU synchronization while doing MTRR register update

The current Xen code does not synchronize all the cpus while
initializing MTRR registers when a cpu comes up.=20

As per IA32 SDM vol 3: Section: 10.11.8 MTRR Considerations in MP
Systems, all the processors should be synchronized while updating
MTRRs.

Processors starting with westmere are caching VMCS data for better VMX
performance. These processors also has Hyper-threading support. With
hyper-threading, when one thread's cache is disabled, it also disables
cache for the sibling threads. And MTRR register updating procedure
involves cache disabling. So if cpus are not synchronized, updating
MTRR registers on a thread, results in the VMCS data from sibling
threads becoming inaccessible, and it causes system failure.

With this patch while updating the MTRR registers, all the cpus are
synchronized as per the IA32 SDM. Also at the boot time and resume
time when multiple cpus are brought up, an optimization is added to
delay the MTRR initialization until all the cpus are up, to avoid
multiple times cpu synchronization.

Signed-off-by: Nitin A Kamble <nitin.a.kamble@intel.com>
Signed-off-by: Suresh B Siddha <suresh.b.siddha@intel.com>
Signed-off-by: Asit K Mallick <asit.k.mallick@intel.com>
16 years agox86: Enable GNTTABOP_copy hypercall for HVMs
Keir Fraser [Wed, 5 Aug 2009 12:49:35 +0000 (13:49 +0100)]
x86: Enable GNTTABOP_copy hypercall for HVMs

This requires plumbing 32-bit compat guests through the compat version
of teh grant-table hypercall.

Signed-off-by: Jayaraman, Bhaskar <Bhaskar.Jayaraman@lsi.com>
16 years agoxm-test restore: use ext3 (instead of ext2) and xvda (instead of hda)
Keir Fraser [Wed, 5 Aug 2009 12:40:21 +0000 (13:40 +0100)]
xm-test restore: use ext3 (instead of ext2) and xvda (instead of hda)

This patch fixes the xm-test restore 04 testcase:
o uses ext3 instead of ext2 - which is not supported by the standard
kernel config
o uses xvdX instead of hdX for disks

Signed-off-by: Andreas Florath <xen@flonatel.org>
16 years agoxm-test: Disable DEBUG_STACK_USAGE which breaks test cases
Keir Fraser [Wed, 5 Aug 2009 12:39:37 +0000 (13:39 +0100)]
xm-test: Disable DEBUG_STACK_USAGE which breaks test cases

The unnecessary 'used greatest stack depth' messages on the console
breaks xm-test cases by random.  Typically a testcase reads input from
the console and parses it.  When DEBUG_STACK_USAGE is enabled, these
stack usage messages are printed by random - the test case reads this
message, cannot handle it and fails.

Signed-off-by: Andreas Florath <xen@flonatel.org>
16 years agoxm-test: fix network13 test (protocol and extensions)
Keir Fraser [Wed, 5 Aug 2009 12:38:38 +0000 (13:38 +0100)]
xm-test: fix network13 test (protocol and extensions)

Attached there is a patch that fixes the used protocol (was udp - but
nobody was listening...) to icmp echo and added the extension, that
the dom0 and the other guest ips are also pinged.
Because of the many different scenarios (three nested loops) over
packet sizes, two guests and different ip addresses, one run of this
test case takes now about 4.5 minutes.

Signed-off-by: Andreas Florath <xen@flonatel.org>
16 years agoxm-test: Adapt memory setting to up-to-date kernel memory consumption
Keir Fraser [Wed, 5 Aug 2009 12:37:26 +0000 (13:37 +0100)]
xm-test: Adapt memory setting to up-to-date kernel memory consumption

The attached patch fixes xm-test memset 04 that it can be used with up
to date kernels.  The old version sets the memory to 15MByte which is
too low for modern kernels: the oom-killer in this case kills the
login shell of the test-case and init.  Increased the size to 18M
which gives the userspace about 2.5 MByte memory.

Signed-off-by: Andreas Florath <xen@flonatel.org>
16 years agoxm-test: 10_block_attach_detach_multiple_devices fixed
Keir Fraser [Wed, 5 Aug 2009 12:36:24 +0000 (13:36 +0100)]
xm-test: 10_block_attach_detach_multiple_devices fixed

This patch fixes and (re-)enables test 10 of the block-create suite.
The tests by random attach and detach devices to / from a domU and
checks if everything is ok.

Signed-off-by: Andreas Florath <xen@flonatel.org>
16 years agoxm-test block-create: use ext3 as filesystem
Keir Fraser [Wed, 5 Aug 2009 11:06:24 +0000 (12:06 +0100)]
xm-test block-create: use ext3 as filesystem

The current implementation uses ext2 for tests.  The tests currently
fail, because the current kernel does not support ext2 by default.
This patch creates an ext3 filesystem for the tests.

Signed-off-by: Andreas Florath <xen@flonatel.org>
16 years agoxend: fix memory leak resulting in long garbage collector runs
Keir Fraser [Wed, 5 Aug 2009 11:04:39 +0000 (12:04 +0100)]
xend: fix memory leak  resulting in long garbage collector runs

In the method xen.xend.XendStateStore.XendStateStore.load_state and
xen.xend.XendStateStore.XendStateStore.save_state the minidom objects
used to load/save the current state of a device type, can't be freed
by the python garbage collector after all references to the top node
are cleared, because of cyclic references between the DOM nodes. So
memory usage of xend increases after calling these methods.  To solve
this problem, the unlink() method must be called for a minidom object
before the last reference to the top node is cleared (see python
docs). This breaks the cyclic references, so the garbage collector can
free these objects.

Signed-off-by: juergen.gross@ts.fujitsu.com
16 years agoxend: pass-through: Extend multi-function mapping
Keir Fraser [Wed, 5 Aug 2009 11:03:53 +0000 (12:03 +0100)]
xend: pass-through: Extend multi-function mapping

This extends the mapping between physical and virtual PCI functions
for multi-function pass-through in two ways. If neither of these
rules apply the existing identity-mapping of physical to virtual
functions is used.

1) If physical function zero is not present in a multi-function
   pass-through device then the numerically lowest physical function
   whose virtual function hasn't explicitly been set will be mapped
   to virtual function 0.

   This is to satisfy the requirement that a (virtual) device
   must always have function 0 present.

2) The virtual function to be used for a physical function may
   be explicitly set.

   e.g. 00:1d.2=3D0,1=3D1,0=3D2@7 will result in the following
   mapping:

        physical | virtual
        ---------+--------
        00:1d.2  | 00:07.0
        00:1d.1  | 00:07.1
        00:1d.0  | 00:07.2

   Ranges may also be used with explicit assignment.
   The following would result in the same mapping as above:

       00:1d.2=3D0-0=3D2@7

Please be aware that it is very likely that using these extensions
it is possible to create mappings that do not work. If in doubt
please use identity-mapping.

Cc: Dexuan Cui <dexuan.cui@intel.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
16 years agoxend: passthrough: add checking when a device is hotplugged into pv guest.
Keir Fraser [Wed, 5 Aug 2009 11:03:08 +0000 (12:03 +0100)]
xend: passthrough: add checking when a device is hotplugged into pv guest.

When we 'xm pci-attach' device into pv guest, we also need to check if
the device is owned by pciback or pci-stub, if the device has been
assigned, etc.

Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
16 years agoAdd a single trigger for all diagnostic keyhandlers
Keir Fraser [Sun, 2 Aug 2009 12:43:15 +0000 (13:43 +0100)]
Add a single trigger for all diagnostic keyhandlers

Add a new keyhandler that triggers all the side-effect-free
keyhandlers.  This lets automated tests (and users) log the full set
of keyhandlers without having to be aware of which ones might reboot
the host.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agoMake ACPI Cx keyhandler always print something
Keir Fraser [Sun, 2 Aug 2009 11:29:25 +0000 (12:29 +0100)]
Make ACPI Cx keyhandler always print something

...so that from a serial log you can tell the difference between not
pressing the key and not having anything interestying to print.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
16 years agoxend: pci: Use PCIe FLR for VF of Intel 82599 10GbE Controller
Keir Fraser [Sun, 2 Aug 2009 11:28:22 +0000 (12:28 +0100)]
xend: pci: Use PCIe FLR for VF of Intel 82599 10GbE Controller

We know it does have PCIe FLR capability even if it doesn't report
that.

Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
16 years agoxend: passthrough: loosen the pci co-assignment for pv guest
Keir Fraser [Sun, 2 Aug 2009 11:27:51 +0000 (12:27 +0100)]
xend: passthrough: loosen the pci co-assignment for pv guest

In current xend, we can not assign co-assignment devices to different
guests, even for pv guests. This patch loosens the policy for pv
guest: if none of the co-assignment devices have been assigned to hvm
guest, we can assign the devices to different pv guests.

The patch also adds a detection: if a device has been assigned to
guest, we can't try to "xm pci-attach" it to the same guest again.

Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
16 years agoxend: save/restore cpu_weight and cpu_cap
Keir Fraser [Sun, 2 Aug 2009 11:26:23 +0000 (12:26 +0100)]
xend: save/restore cpu_weight and cpu_cap

This patch allows vcpus_params cpu_weight and cpu_cap to be saved and
restored.  Most the code to support this already existed, but the save
path needed to be updated to explicitly save these params, and the
restore path needed to be updated to resend the params down to the
kernel.

From: Andrew Jones <drjones@redhat.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agoCompile the kernel by default with bridge support
Keir Fraser [Sun, 2 Aug 2009 11:25:01 +0000 (12:25 +0100)]
Compile the kernel by default with bridge support

This one-liner adds bridge support to the Linux kernel
(CONFIG_BRIDGE=y).  It is a precondition for some xm-tests that
bridge is enabled.  Also IMHO it makes sense to configure a dom0 with
bridge capabilities.

Signed-off-by: Andreas Florath <xen@flonatel.org>
16 years agoxm-test: ramdisk fs type is changed to ext3 if needed
Keir Fraser [Sun, 2 Aug 2009 11:23:46 +0000 (12:23 +0100)]
xm-test: ramdisk fs type is changed to ext3 if needed

This (one line) patch changes the type of the xm-test initrd from ext2
to ext3 when needed.  It first checks, if ext2 support is missing and
ext3 support is available.  If so the fs type is changed to ext3.

Signed-off-by: Andreas Florath <xen@flonatel.org>
16 years agotools/tests/regression/: Fix some paths and scripts.
Keir Fraser [Sun, 2 Aug 2009 11:22:03 +0000 (12:22 +0100)]
tools/tests/regression/: Fix some paths and scripts.

o scripts and Makefile are mostly location independent now
  (exception XEN_ROOT in Makefile)
o use of $() instead of ${} in Makefile

From: Andreas Florath <xen@flonatel.org>
Signed-off-by: Keir Fraser <Keir.Fraser@eu.citrix.com>
16 years agoi386: fix full-value calculation of wrmsr handling for pv guests
Keir Fraser [Thu, 30 Jul 2009 16:56:23 +0000 (17:56 +0100)]
i386: fix full-value calculation of wrmsr handling for pv guests

The MSR value must be held in a 64-bit variable, not an unsigned long.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agoxm-test: Fix memset 01 and 02 tests: add support for sysfs memory interface
Keir Fraser [Wed, 29 Jul 2009 08:20:46 +0000 (09:20 +0100)]
xm-test: Fix memset 01 and 02 tests: add support for sysfs memory interface

From: Andreas Florath <xen@flonatel.org>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agoxend: pci: fix a typo in do_Dstate_transition
Keir Fraser [Wed, 29 Jul 2009 08:19:30 +0000 (09:19 +0100)]
xend: pci: fix a typo in do_Dstate_transition

Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
16 years agoxend: pass-through Use pci_dict_to_bdf_str() in hvm_pci_device_create()
Keir Fraser [Wed, 29 Jul 2009 08:19:13 +0000 (09:19 +0100)]
xend: pass-through Use pci_dict_to_bdf_str() in hvm_pci_device_create()

* Use pci_dict_to_bdf_str() in hvm_pci_device_create()
* Use pci_name instead of pci_str in error message, pci_str does not
* exist

Signed-off-by: Simon Horman <horms@verge.net.au>
Acked-by: Dexuan Cui <dexuan.cui@intel.com>
16 years agons16550: check_existence() can be marked __init
Keir Fraser [Tue, 28 Jul 2009 15:48:06 +0000 (16:48 +0100)]
ns16550: check_existence() can be marked __init

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
16 years agons16550: More robust check for presence of FIFO
Keir Fraser [Tue, 28 Jul 2009 15:47:37 +0000 (16:47 +0100)]
ns16550: More robust check for presence of FIFO

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
16 years agoxend: make a crash dump directory per DomU
Keir Fraser [Tue, 28 Jul 2009 15:43:50 +0000 (16:43 +0100)]
xend: make a crash dump directory per DomU

Currently, xend dumps a core file of a DomU
in the directory "/var/xen/dump/", when the DomU has crashed.

The patch modifies this directory to "/var/xen/dump/<domain name>/".

It enables you to select HDD partition per DomU to dump core by using
mount command.

Signed-off-by: Rikiya Ayukawa <ayukawa.rikiya@jp.fujitsu.com>
16 years agoxend: pass-through: fix "xm pci-list-assignable-devices' for pv_guest
Keir Fraser [Tue, 28 Jul 2009 15:42:12 +0000 (16:42 +0100)]
xend: pass-through: fix "xm pci-list-assignable-devices' for pv_guest

xc.test_assign_device(dev) can only tell us if dev is assigned to hvm
guest; if a device is assigned to pv guest, xc.test_assign_device()
still tells us the device is not assigned yet, as a result, the device
still appears in the output of "xm pci-list-assignable-devices", and
xend would not prevent us from assigning the device to a new pv or hvm
guest.

To judge if a device has been assigned to guest, we have to scan
xenstore.

Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
16 years agoxend: pass-through: fix pci passthrough for pv guest
Keir Fraser [Tue, 28 Jul 2009 15:41:13 +0000 (16:41 +0100)]
xend: pass-through: fix pci passthrough for pv guest

C/S 19754: a5f584c1e2f6 breaks pci passthrough for pv guest.

Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
16 years agox86,hvm: clean up vpt's period_cycles field
Keir Fraser [Tue, 28 Jul 2009 15:40:34 +0000 (16:40 +0100)]
x86,hvm: clean up vpt's period_cycles field

In struct periodic_time, pt->period_cycles is not cpu cycles since c/s
17716 and its value is always the same as pt->period.

Signed-off-by: Kouya Shimura <kouya@jp.fujitsu.com>
16 years agotools/tests: Add syntax check for different versions of python
Keir Fraser [Tue, 28 Jul 2009 15:38:08 +0000 (16:38 +0100)]
tools/tests: Add syntax check for different versions of python

From: Andreas Florath <xen@flonatel.org>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agox86: Initialize the ACPI "safe" power state to C1.
Keir Fraser [Tue, 28 Jul 2009 15:34:16 +0000 (16:34 +0100)]
x86: Initialize the ACPI "safe" power state to C1.

Initialize the ACPI "safe" power state to C1.  This avoids a null
dereference on BIOS tables which define C3 but not C2 or C1.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
16 years agoxend: fix migration hangs by closing fds on exec
Keir Fraser [Tue, 28 Jul 2009 15:33:46 +0000 (16:33 +0100)]
xend: fix migration hangs by closing fds on exec

Signed-off-by: Zhigang Wang <zhigang.x.wang@oracle.com>
Reviewed-by: Xiaowei Hu <xiaowei.hu@oracle.com>
16 years agoxend: pass-through: device state in xenstore may be null
Keir Fraser [Tue, 28 Jul 2009 15:32:26 +0000 (16:32 +0100)]
xend: pass-through: device state in xenstore may be null

Signed-off-by: Tom Rotenberg <tom.rotenberg@gmail.com>
16 years agopassthrough: use tasklet to deliver interrupts
Keir Fraser [Tue, 28 Jul 2009 15:28:21 +0000 (16:28 +0100)]
passthrough: use tasklet to deliver interrupts

This patch enables delivery of interrupts even if the VCPU#0 is
halted.

Note: the changes to softirq.{ch} are needed for ia64 build.

Signed-off-by: Kouya Shimura <kouya@jp.fujitsu.com>
16 years agohvm vlapic: Fix vlapic_write() for partial register writes.
Keir Fraser [Tue, 28 Jul 2009 15:24:47 +0000 (16:24 +0100)]
hvm vlapic: Fix vlapic_write() for partial register writes.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agoxend: pass-through: Use parse_pci_name() in find_parent()
Keir Fraser [Tue, 28 Jul 2009 15:16:32 +0000 (16:16 +0100)]
xend: pass-through: Use parse_pci_name() in find_parent()

Signed-off-by: Simon Horman <horms@verge.net.au>
16 years agox86_32: handle x87 opcodes in TLS segment fixups
Keir Fraser [Tue, 28 Jul 2009 15:15:18 +0000 (16:15 +0100)]
x86_32: handle x87 opcodes in TLS segment fixups

This patch adds support to the TLS fixup code for x87 opcodes.  These
can be treated like 2-byte opcodes with a weird encoding.

The patch includes some extra changes because, now that we have >2
opcode tables and 9 different lead bytes in a two-byte opcode, a
simple boolean code will not be enough to differentiate one- and
two-byte opcodes.  Besides this, the patch is trivial since the
segment fixup code cares about the operands of the instruction, not
about its semantics.

From: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agoRevert 19961: breaks xend start on some systems.
Keir Fraser [Fri, 24 Jul 2009 11:08:54 +0000 (12:08 +0100)]
Revert 19961: breaks xend start on some systems.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agoxend: Fix use of set() for Python 2.3.
Keir Fraser [Fri, 24 Jul 2009 09:39:43 +0000 (10:39 +0100)]
xend: Fix use of set() for Python 2.3.

From: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agohvmloader: Fix get_memsize() to cast high_mem_pgend to 64 bits.
Keir Fraser [Fri, 24 Jul 2009 09:37:52 +0000 (10:37 +0100)]
hvmloader: Fix get_memsize() to cast high_mem_pgend to 64 bits.

Signed-off-by: Joe Jin <joe.jin@oracle.com>
16 years agopython: make tools/python/xen/util/fileuri.py work on python 2.3
Keir Fraser [Thu, 23 Jul 2009 08:01:30 +0000 (09:01 +0100)]
python: make tools/python/xen/util/fileuri.py work on python 2.3

@staticmethod syntax sugar was introduced at python2.4.
expand the syntax sugar for python 2.3

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
16 years agohoplugpath.sh: fix Makefile dependency.
Keir Fraser [Thu, 23 Jul 2009 08:00:55 +0000 (09:00 +0100)]
hoplugpath.sh: fix Makefile dependency.

In tools/hotplug/common/Makefile, install-scripts depends on genpath.
So add its dependency. Otherwise parallel build sometimes fails as
follows.

genpath and install-scripts command are being run simultaneously.
So When install-scripts tries to install it, it can be under creation.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
16 years agoxend: Don't call decode() if PV_{kernel,ramdisk} are ''
Keir Fraser [Thu, 23 Jul 2009 08:00:21 +0000 (09:00 +0100)]
xend: Don't call decode() if PV_{kernel,ramdisk} are ''

Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
16 years agoxend: Set up CPUID leaves on restore for both PV and HVM guests.
Keir Fraser [Thu, 23 Jul 2009 07:59:03 +0000 (08:59 +0100)]
xend: Set up CPUID leaves on restore for both PV and HVM guests.

From: Andrew Thomas <andrew.thomas@oracle.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agofs-front: cope with a missing fs-backend
Keir Fraser [Thu, 23 Jul 2009 07:57:02 +0000 (08:57 +0100)]
fs-front: cope with a missing fs-backend

Obviously save\restore is not going to work if fs-backend is missing,
but at least the stubdom will be able to work correctly in all the
other cases.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
16 years agostubdom: update README as no reason to specify absolute paths
Keir Fraser [Thu, 23 Jul 2009 07:56:15 +0000 (08:56 +0100)]
stubdom: update README as no reason to specify absolute paths

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
16 years agoRevert QEMU_TAG to 5cc34ea27f1cbd1a0560cfca91fb89ccd6d5726f
Keir Fraser [Thu, 23 Jul 2009 07:53:00 +0000 (08:53 +0100)]
Revert QEMU_TAG to 5cc34ea27f1cbd1a0560cfca91fb89ccd6d5726f

xenstore lowlevel function changes breaks stubdom build.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agotools: xenbackendd for NetBSD
Keir Fraser [Wed, 22 Jul 2009 13:37:30 +0000 (14:37 +0100)]
tools: xenbackendd for NetBSD

Attached patch introduces xenbackendd. It is used on NetBSD
to launch the hotplug scripts. Later xenbackendd can be improved to
also launch qemu-dm as child process and will notice when qemu-dm
crashes.

The changes the patch makes:
- rename hotplug scripts as xenbackendd expects them
  (current names were taken from pkgsrc)
- install hotplug scripts as executable scripts
- introduce xenbackendd
- build/install/launch on NetBSD only

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
16 years agopage allocator: add mfn_valid() check to free_heap_pages() and scrub_pages()
Keir Fraser [Wed, 22 Jul 2009 13:06:21 +0000 (14:06 +0100)]
page allocator: add mfn_valid() check to free_heap_pages() and scrub_pages()

The changesets, 19913:ef38784f9f85 and 19914:d6c1d7992f43 eliminates
boot allocator bitmap which is also used for buddy allocator bitmap.
With those patches, xen/ia64 doesn't boot because page allocator
touches struct page_info which doesn't exist.
That happends because memory is populated sparsely on ia64
and struct page_info is so.

This patches fixes ia64 boot failure.
In fact, this is also a potential bug on x86. max_page seems
to be well aligned so that MAX_ORDER loop check prevented
to be bug appear.

- fix free_heap_pages().
  When merging chunks, buddy page_info() doesn't always exists.
  So check it by mfn_valid().

- fix scrub_pages()
  On ia64 page_info() is sparsely populated, so struct page_info
  doesn't always exist. Check it by mfn_valid()

- offline_pages(), online_pages() and query_page_offline()
  Also replace "< max_page" check with mfn_valid() for consistency.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
16 years agoxend: pass-through: use identity-mapping of PCI functions
Keir Fraser [Wed, 22 Jul 2009 13:05:26 +0000 (14:05 +0100)]
xend: pass-through: use identity-mapping of PCI functions

This reverses changeset "xend: pass-through: Implement least-mapping
of virtual" (19854:22067ba1de0d) and reverts the code to identity
mapping physical PCI functions to virtual ones when multi-function
virtual devices are in use. It is my opinion that this is both safer
and simpler than least-mapping, and that in the absence of further
analysis identity-mapping the best choice for now.

Signed-off-by: Simon Horman <horms@verge.net.au>
16 years agotools: implement balloon stat and cpuinfo for NetBSD
Keir Fraser [Wed, 22 Jul 2009 13:04:14 +0000 (14:04 +0100)]
tools: implement balloon stat and cpuinfo for NetBSD

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
16 years agox86 mce: Fix formatting in a couple of printks.
Keir Fraser [Wed, 22 Jul 2009 13:03:32 +0000 (14:03 +0100)]
x86 mce: Fix formatting in a couple of printks.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
16 years agoUpdate QEMU_TAG to a42b67ed27a9744a2492c8ffe5c26935bd19ee27
Keir Fraser [Wed, 22 Jul 2009 13:02:36 +0000 (14:02 +0100)]
Update QEMU_TAG to a42b67ed27a9744a2492c8ffe5c26935bd19ee27

16 years agoxsm: Move ACM_DEBUG and printkd() out of public header. They are
Keir Fraser [Tue, 21 Jul 2009 14:47:41 +0000 (15:47 +0100)]
xsm: Move ACM_DEBUG and printkd() out of public header. They are
private to the ACM implementation within Xen.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agoxsm: Do not use gcc-ism in public header file.
Keir Fraser [Tue, 21 Jul 2009 14:34:56 +0000 (15:34 +0100)]
xsm: Do not use gcc-ism in public header file.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
16 years agoxend: pass-through: fix regression in the ordering of the output of xm pci list
Keir Fraser [Tue, 21 Jul 2009 13:26:52 +0000 (14:26 +0100)]
xend: pass-through: fix regression in the ordering of the output of xm pci list

changeset "python: Remove tab indents" (19937:e845326ae203)
introduces a minor regression in the multi-function PCI pass-through
code by causing bogus return values from the sort function
which is used to order the output of "xm pci list".

Signed-off-by: Simon Horman <horms@verge.net.au>
16 years agoRevert part of c/s 19349: fixes qcow for HVM guests
Keir Fraser [Tue, 21 Jul 2009 11:06:52 +0000 (12:06 +0100)]
Revert part of c/s 19349: fixes qcow for HVM guests

16 years agoRemove support for out-of-date SLES9 and RHEL4 kernel
Keir Fraser [Mon, 20 Jul 2009 14:51:14 +0000 (15:51 +0100)]
Remove support for out-of-date SLES9 and RHEL4 kernel
ports  from build integration

Both distros now include Xen support from their respective upstreams
and these kernels are very out of date wrt both the upstream distro
kernel and the upstream Xen kernel.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
16 years agolibxenguest: Revert domain builder interface changes for 'superpages'
Keir Fraser [Mon, 20 Jul 2009 14:45:50 +0000 (15:45 +0100)]
libxenguest: Revert domain builder interface changes for 'superpages'
parameter, and place the flag in a pad byte of 'struct xc_dom_image'
instead.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agolibxc: Use a single mmap interface to Linux
Keir Fraser [Mon, 20 Jul 2009 09:58:06 +0000 (10:58 +0100)]
libxc: Use a single mmap interface to Linux

Modify xc_map_foreign_range and xc_map_foreign_ranges to call
mmap_map_foreign_batch. This eliminates the need for multiple privcmd
mmap ioctls. Now only IOCTL_PRIVCMD_MMAPBATCH is required.

Signed-off-by: Patrick Colp <Patrick.Colp@citrix.com>
16 years agoxend: Add support for URI ('file:' and 'data:' scheme) for PV/kernel and PV/ramdisk
Keir Fraser [Mon, 20 Jul 2009 09:12:38 +0000 (10:12 +0100)]
xend: Add support for URI ('file:' and 'data:' scheme) for PV/kernel and PV/ramdisk

Add support for 'file:' and 'data:' URI schemes for the parameters
'PV/kernel' and 'PV/ramdisk' in the VM.create() call.  The 'data:'
scheme handling enables using a file which is stored inside the
management system (from where the XenAPI call is send) as kernel or
ramdisk.

Notes:
o all included: a detailed description can be found in the xenapi
documentation
o bumped up the version of the API document to 1.0.8 (because of
(minimal) interface extension)
o Future enhancements (like http:, ftp: schemes) fit seamlessly into
the current design / classes

Signed-off-by: Andreas Florath <xen@flonatel.org>
16 years agox86: make show_page_walk() more robust
Keir Fraser [Mon, 20 Jul 2009 09:10:15 +0000 (10:10 +0100)]
x86: make show_page_walk() more robust

Also add in a missing line in x86-64's do_page_walk().

Signed-off-by: Jan Beulich <jbeulich@novell.com>
16 years agoxend: modify sort() for Python 2.3
Keir Fraser [Mon, 20 Jul 2009 09:09:00 +0000 (10:09 +0100)]
xend: modify sort() for Python 2.3

Python 2.3 does not support the sort(cmp, key, reverse) style.

Signed-off-by: KUWAMURA Shin'ya <kuwa@jp.fujitsu.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
16 years agoblktap2: Remove set() for Python 2.3
Keir Fraser [Mon, 20 Jul 2009 09:08:12 +0000 (10:08 +0100)]
blktap2: Remove set() for Python 2.3

Signed-off-by: KUWAMURA Shin'ya <kuwa@jp.fujitsu.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
16 years agoia64: Define paging_mode_external(), now needed by grant_table.c
Keir Fraser [Mon, 20 Jul 2009 09:07:28 +0000 (10:07 +0100)]
ia64: Define paging_mode_external(), now needed by grant_table.c

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agoUse git smart server protocol for qemu tree by default
Keir Fraser [Mon, 20 Jul 2009 09:02:50 +0000 (10:02 +0100)]
Use git smart server protocol for qemu tree by default

xenbits supports the git protocol now, which is much faster (and
produces less noise in the build log too).

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
16 years agoxend: Restore scheduling parameters
Keir Fraser [Thu, 16 Jul 2009 09:32:55 +0000 (10:32 +0100)]
xend: Restore scheduling parameters

Scheduling parameters are reset to default values when I restore
or migrate a domain.

Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
16 years agohvmloader: Add new test for MSR_SHADOW_GS_BASE validity after SWAPGS instruction.
Keir Fraser [Thu, 16 Jul 2009 09:30:50 +0000 (10:30 +0100)]
hvmloader: Add new test for MSR_SHADOW_GS_BASE validity after SWAPGS instruction.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agovmx: Fix handling of FS/GS base MSRs.
Keir Fraser [Thu, 16 Jul 2009 09:26:55 +0000 (10:26 +0100)]
vmx: Fix handling of FS/GS base MSRs.

Firstly, these MSRs are always accessible if the CPU supports them --
we should not check for EFER.LMA.

Secondly, we should not use teh cached value of shadow_gs while the
VCPU is running. It can be stale if the guest has executed SWAPGS
(which we cannot trap). Hence always access the underlying host MSR
when emulating guest accesses.

The latter bug was found and a patch proposed by <leonid@3tera.com>

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agotmem: No noise when disabled and not configured
Keir Fraser [Thu, 16 Jul 2009 07:30:23 +0000 (08:30 +0100)]
tmem: No noise when disabled and not configured

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agox86 svm: Disable intercepting CR3 writes when nested paging is enabled
Keir Fraser [Thu, 16 Jul 2009 07:26:29 +0000 (08:26 +0100)]
x86 svm: Disable intercepting CR3 writes when nested paging is enabled

This patch disables intercepting CR3 writes when nested paging is
enabled. For applications which cause excessive CR3 accesses, the
patch can increase their performance.

Signed-off-by: Wei Huang <wei.huang2@amd.com>
16 years agox86: extend some of Intel's recent MCE work to also support AMD
Keir Fraser [Wed, 15 Jul 2009 15:21:12 +0000 (16:21 +0100)]
x86: extend some of Intel's recent MCE work to also support AMD

At least the MSR handling for guests can easily be made shared between
the two vendors; likely a lot of the other code in mce_intel.c could
also be made common. The goal here, however, is to eliminate the
annoying guest-tried-to-modify-msr messages that result from enabling
the MCE code on the Linux side.

Additionally (in order for not having to make the same change twice to
basically identical code) the patch also merges
amd_{fam10,k8}_mcheck_init(), enables the former to also be used for
Fam11 (I'd suppose that Fam12 would also need to go here, but I have
no data to confirm that), and does some minor (mostly coding style for
the code moved around) adjustments.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
16 years agotools/check: We do need a default for ${PYTHON} as called from
Keir Fraser [Wed, 15 Jul 2009 14:33:05 +0000 (15:33 +0100)]
tools/check: We do need a default for ${PYTHON} as called from
install.sh with PYTHON possibly undefined in the environment.

So we make PYTHON=python the sensible default.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agotools/check: No need to check for ${PYTHON} existence.
Keir Fraser [Wed, 15 Jul 2009 13:53:01 +0000 (14:53 +0100)]
tools/check: No need to check for ${PYTHON} existence.

It must exist as otherwise the build will fail since we reference
$(PYTHON) all over the place. Furthermore the fallback of
'/usr/bin/env python' actually runs Python, it doesn't get the path to
it. So that wouldn't work very well.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agoi386: eliminate unsupported CPUs' MCA handling code
Keir Fraser [Wed, 15 Jul 2009 13:35:34 +0000 (14:35 +0100)]
i386: eliminate unsupported CPUs' MCA handling code

Neither Intel P5 nor Winchip are supported by Xen (due to
-march=i686 being passed to the compiler), so there is no point in
having code for handling their (rudimentary) MCA capabilities.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
16 years agoRename for_each_cpu() to for_each_possible_cpu()
Keir Fraser [Wed, 15 Jul 2009 12:15:50 +0000 (13:15 +0100)]
Rename for_each_cpu() to for_each_possible_cpu()

... to be more precise in naming, and also to match Linux.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
16 years agoi386: fix handling of Xen entries in final L2 page table
Keir Fraser [Wed, 15 Jul 2009 12:07:30 +0000 (13:07 +0100)]
i386: fix handling of Xen entries in final L2 page table

Running Xen on top of KVM exposed an issue that latently also exists
on real hardware: So far, updating any L3 entry resulted in the Xen
owned part of the L2 table referenced by the final L3 one to be re-
initialized. This was not only unnecessary, it actually resulted in
Xen relying on the TLB entry which maps the L2 page that's being
updated not going away intermediately, since as a first step the full
range of Xen owned entries in the L2 were replaced by the respective
ones from the idle page table, and only then the per-domain entries
got re- written to their intended values.

This part of the initialization really is sufficient to be done once,
when the page becomes an L2-with-Xen-entries (PGT_pae_xen_l2) one,
i.e. can be moved to alloc_l2_table(). Only the linear page table
setup has to remain where it always was.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
16 years agostubdom: make -> $(MAKE)
Keir Fraser [Wed, 15 Jul 2009 09:31:50 +0000 (10:31 +0100)]
stubdom: make -> $(MAKE)

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
16 years agoFix a couple of comment typos.
Keir Fraser [Wed, 15 Jul 2009 09:30:59 +0000 (10:30 +0100)]
Fix a couple of comment typos.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
16 years agox86: Fix an oversight of c/s 19927 - per-CPU data accesses must
Keir Fraser [Wed, 15 Jul 2009 08:14:19 +0000 (09:14 +0100)]
x86: Fix an oversight of c/s 19927 - per-CPU data accesses must
not be iterated over using NR_CPUS bound loops.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
16 years agostubdom: don't leak include dir on distclean
Keir Fraser [Wed, 15 Jul 2009 08:11:40 +0000 (09:11 +0100)]
stubdom: don't leak include dir on distclean

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>